package com.bt.lms.utils;


import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

/**
 * JDBC工具类
 * @author 朱传博
 */
public class JDBCUtils {


    public static Connection JDBC() {


        try {
            //加载驱动
            Class.forName("com.mysql.cj.jdbc.Driver");

            //2.获取连接
            String url = "jdbc:mysql://127.0.0.1:3306/bot_lms?serverTimezone=UTC";
            String userName = "root";
            String psw = "mysql";

            Connection connection = DriverManager.getConnection(url, userName, psw);


            return connection;


        } catch (ClassNotFoundException e) {
            throw new RuntimeException(e);
        } catch (SQLException e) {
            throw new RuntimeException(e);
        }


    }
}
